<template>
	<div class="app-container">
		<el-descriptions class="margin-top" :column="3" size="default" border>
			<el-descriptions-item>
			  <template #label>
			    <div class="cell-item">
					卡次ID
			    </div>
			  </template>
			  <el-link type="primary" @click="openRecord">{{info.id}}</el-link>
			</el-descriptions-item>
		    <el-descriptions-item>
		      <template #label>
		        <div class="cell-item">
		          卡次类型
		        </div>
		      </template>
			  {{info.text.type}}
		    </el-descriptions-item>
		    <el-descriptions-item>
		      <template #label>
		        <div class="cell-item">
		          卡次名称
		        </div>
		      </template>
			  {{info.name}}
		    </el-descriptions-item>
		    <el-descriptions-item>
		      <template #label>
		        <div class="cell-item">
		          会员信息
		        </div>
		      </template>
			  {{info.meNickname}}||{{info.meId}}
		    </el-descriptions-item>
		    <el-descriptions-item>
		      <template #label>
		        <div class="cell-item">
		          开卡日期
		        </div>
		      </template>
			  {{parseTime(info.startTime, '{y}-{m}-{d}')}}
		    </el-descriptions-item>
		    <el-descriptions-item>
		      <template #label>
		        <div class="cell-item">
		          到期日期
		        </div>
		      </template>
			  {{parseTime(info.endTime, '{y}-{m}-{d}')}}
		    </el-descriptions-item>
			<el-descriptions-item>
			  <template #label>
			    <div class="cell-item">
			      购买次数
			    </div>
			  </template>
			  {{info.numbers}}
			</el-descriptions-item>
			<el-descriptions-item>
			  <template #label>
			    <div class="cell-item">
			      购买价格
			    </div>
			  </template>
			  {{info.price}}
			</el-descriptions-item>
			<el-descriptions-item>
			  <template #label>
			    <div class="cell-item">
			      剩余次数
			    </div>
			  </template>
			  {{info.specificNum}}
			</el-descriptions-item>
			<el-descriptions-item>
			  <template #label>
			    <div class="cell-item">
			      状态
			    </div>
			  </template>
			  {{info.text.status}}
			</el-descriptions-item>
		  </el-descriptions>
			<countRecordIndex ref="countRecordIndexRef"/>
	</div>
</template>

<script setup name="CountSaleInfo">
	import { getByOrderId } from "@/api/crm/countSale";
	import countRecordIndex from "../countRecord/index.vue"
	
	const { proxy } = getCurrentInstance();
	
	const info = ref({text:{}})
	
	
	const props = defineProps({
	    orderId: {
	        type: String
	    }
	})
	
	
	const countRecordIndexRef= ref();
	
	function getInfo(){
		getByOrderId(props.orderId).then(rsp=>{
			info.value = rsp.data
		})
	}
	
	function openRecord(){
		countRecordIndexRef.value.openWin(info.id);
	}
	
	getInfo();
	
</script>

<style>
</style>